package com.njit.mailm.commmon.utils;

import java.io.*;

/**
 * Created by Administrator on 2016/4/6.
 */
public class IOUtil {
    public static  String fileToString(String filepath) {
        BufferedReader br = null;
        StringBuffer sb = null;
        try {
            br = new BufferedReader(new FileReader(filepath));

            sb = new StringBuffer();
            String str = "";
            while((str = br.readLine()) != null){
                sb.append(str);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(br != null){
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }

        return sb.toString();
    }
}
